import Vue from 'vue'
import Vuex from 'vuex'
import { setToken, getToken, deleteToken } from '@/utils/localStorage'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: getToken() || ''
  },
  getters: {
  },
  mutations: {
    setTokenFn (state, data) {
      state.token = data
      setToken(data)
    },
    deleteTokenFn (state) {
      state.token = ''
      deleteToken()
    }
  },
  actions: {
  },
  modules: {
  }
})
